#define _CRT_SECURE_NO_WARNINGS 1


#define _CRT_SECURE_NO_WARNINGS 1


//HJ11
#include<stdio.h>
int main()
{
	int n = 0;
	while (~scanf("%d", &n))
	{
		if (n == 0)
		{
			printf("%d", n % 10);
			continue;
		}
		while (n>0)
		{
			printf("%d", n % 10);
			n /= 10;
		}
		printf("\n");
	}
	return 0;
}


//HJ31
#include<stdio.h>
#include<string.h>
int main()
{
	char s[10001] = { 0 };
	int r = 0;
	while (gets(s)>0)
	{
		char *prt = s;
		char *w[10001] = { NULL };
		while (*prt != '\0')
		{
			if (('a' <= *prt&&'z' >= *prt) || ('A' <= *prt&&'Z' >= *prt))
			{
				w[r++] = prt;
				while (*prt != '\0' && (('a' <= *prt&&'z' >= *prt) || ('A' <= *prt&&'Z' >= *prt)))
				{
					prt++;
				}
				continue;
			}
			*prt = '\0';
			prt++;
		}
		for (int i = r - 1; i >= 0; --i)
		{
			printf("%s ", w[i]);
		}
		printf("\n");
	}
	return 0;
}